<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta name="format-detection" content="telephone=no" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
	<script type="text/javascript" src="static/admin/js/jquery-3.2.1.min.js"></script>
	<script type="text/javascript" src="static/admin/js/rem.js"></script>
	<link rel="stylesheet" href="static/admin/css/index.css" />
	<link rel="stylesheet" href="static/admin/css/icon/iconfont.css" />
	<title>停车缴费</title>
</head>

<body>
	<div class="white">
		<div class="header">
			<img src="/parkinglogo/{$propertyinfo.merchant_logo}" alt="">
			<span>{$aliinfo.parking_name}</span>
			<!-- <span>早早科技停车场</span> -->
		</div>
		<div class="much">
			{$aliinfo.pay_money} 元
		</div>
		<p style="font-size:18px; text-align: center;line-height: 30px;">待付款</p>
		<div class="content">
			<div class="c-top">
			</div>
			<div class="c-bottom">
				<ul class="t-name">
					<li>应付金额</li>
					<li>已付金额</li>
					<li>优惠金额</li>
					<li>车牌号码</li>
					<li>入场时间</li>
					<li>停车时长</li>
				</ul>
				<ul class="t-much">
					<li>{$aliinfo.pay_money} 元</li>
					<li>0.00 元</li>
					<li>0.00 元</li>
					<li>{$aliinfo.car_number}</li>
					<li>{$aliinfo.in_time}</li>
					<li>{$aliinfo.in_duration}</li>
				</ul>
			</div>
		</div>
	</div>
	<div class="footer">
		<p><i class="iconfont layui-extend-gantanhao"></i>立即付款完成自动抬杆，支付宝绑定车牌可快速通行</p>
		<a onclick="order('{$aliinfo.id}','{$aliinfo.pay_money}')" href="javascript:;"><button>立即付款</button></a>
	</div>
	<!-- <div class="copyright">
		<p>本服务由{$propertyinfo.merchant_name}提供</p>
		<p>本服务由早早科技提供</p>
		<p>客服电话<a href="javascript:;">{$propertyinfo.merchant_service_phone}</a></p>
	</div> -->

	<script type="application/javascript">
		function order(id,pay_money){
			var url = '{:url("admin/Order/aliorder")}'
			$.post(url, {id: id,pay_money: pay_money}, function(r){
				// console.log(r)
				// return
				if (r.order_no) {
					tradePay(r.order_no)
				}else{
					alert(r.info)
                    location.reload()
                    // window.location.href="{:url('admin/Order/orderindex')}";
				}
			})
		}

		// 由于js的载入是异步的，所以可以通过该方法，当AlipayJSBridgeReady事件发生后，再执行callback方法
		function ready(callback) {
			 if (window.AlipayJSBridge) {
				 callback && callback();
			 } else {
				 document.addEventListener('AlipayJSBridgeReady', callback, false);
			 }
		}
	
		function tradePay(tradeNO) {
			ready(function(){
				 // 通过传入交易号唤起快捷调用方式(注意tradeNO大小写严格)
				 AlipayJSBridge.call("tradePay", {
					  tradeNO: tradeNO
				 }, function (data) {
					 if ("9000" == data.resultCode) {
						 //var url = "{:url('admin/invoice/apply')}?orderid="+"{$aliinfo.id}";
						 //https://s.click.taobao.com/xOjO4xv  
						var url="https://s.click.taobao.com/ZAyf3hv";
						window.location.href=url;
					 }
				 });
			});
		}
	</script>
</body>

</html>